package com.fingard.dsp.bank.reqrespobj.decontract.detail;

import com.fingard.dsp.bank.reqrespobj.decontract.ReqDeContract;
import com.fingard.text.StringHelper;
import com.fingard.xml.XmlTextWriter;

import java.util.HashMap;

public class RetAtsDeContractDetail {
	public String respCode;
    public String respInfo;
    public String reqSeqID;
    
    /** 解约状态 */
    public String deSignState;
	/** 短信签约码 */
	public String token;
	/** 解约确认标识 */
	public String step;
	/** 解约统一映射码 */
	public String unifiedCode;


    public RetAtsDeContractDetail() {
    }

    public RetAtsDeContractDetail(ReqDeContract p_req) {
        reqSeqID = p_req.contractDetail.askNumber;
    }
    
    public void writeToXml(XmlTextWriter retXmlWriter) throws Exception{
    	retXmlWriter.writeStartElement("DetailRecord");
    	
		retXmlWriter.writeElementString("RespCode", respCode);
		retXmlWriter.writeElementString("RespInfo", respInfo);
		retXmlWriter.writeElementString("ReqSeqID", reqSeqID);
		if (StringHelper.hasAnyChar(deSignState)) {
			retXmlWriter.writeElementString("DeSignState", deSignState);
		}
		if(StringHelper.hasAnyChar(token)) {
			retXmlWriter.writeElementString("Token", token);
		}
		if(StringHelper.hasAnyChar(step)) {
			retXmlWriter.writeElementString("Step", step);
		}
		if(StringHelper.hasAnyChar(unifiedCode)) {
			retXmlWriter.writeElementString("UnifiedCode", unifiedCode);
		}
    }
    
    public HashMap<String,String> writeToHash(){
    	HashMap<String,String> retHash = new HashMap<String,String>();
    	
    	retHash.put("RespCode", respCode);
    	retHash.put("RespInfo", respInfo);
    	retHash.put("RdSeq", reqSeqID);
    	if (StringHelper.hasAnyChar(deSignState)) {
    		retHash.put("DeSignState", deSignState);
		}
		if(StringHelper.hasAnyChar(token)) {
			retHash.put("Token", token);
		}
		if(StringHelper.hasAnyChar(step)) {
			retHash.put("Step", step);
		}
		if(StringHelper.hasAnyChar(unifiedCode)) {
			retHash.put("UnifiedCode", unifiedCode);
		}
    	return retHash;
    }
}